﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tracy.DataModel.UltraExplorer;
using Tracy.DataModel;

namespace Tracy.Plugins.Classifiers.FileClassifiers
{
    public class FormatFileClassifier : AbstractClassifier<MediaFile>
    {
        protected override List<string> GetCategories(MediaFile file)
        {
            List<string> rtn = new List<string>();
            if (file != null && file.Resource != null && file.Resource.Format != null)
            {
                rtn.Add(file.Resource.Format.Name);
            }
            return rtn;
        }

        public override bool MatchCategory(MediaFile item, string key)
        {
            if (item != null && item.Resource != null && item.Resource.Format != null)
            {
                return String.Equals(item.Resource.Format.Name, key, StringComparison.OrdinalIgnoreCase);
            }
            return false;
        }
    }


}
